package com.ruoyi.weiriya.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.ruoyi.weiriya.domain.WArea;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 小区信息（停车点位）Mapper接口
 * 
 * @author lynn
 * @date 2023-08-01
 */
public interface WAreaMapper extends BaseMapper<WArea>
{

    @Select("SELECT a.*, u.nick_name, u.phonenumber, c.name as company_name " +
            "FROM w_area a " +
            "LEFT JOIN sys_user u on u.user_id = a.user_id " +
            "LEFT JOIN w_company c on c.id = a.company_id ${ew.customSqlSegment}")
    List<WArea> getList(@Param(Constants.WRAPPER) QueryWrapper<WArea> queryWrapper);

    @Select("SELECT a.*, u.nick_name, u.phonenumber, c.name as company_name " +
            "FROM w_area a " +
            "LEFT JOIN sys_user u on u.user_id = a.user_id " +
            "LEFT JOIN w_company c on c.id = a.company_id " +
            "WHERE a.id = #{id}")
    WArea getWAreaById(String id);
}
